import ModuleManager from "./cfw/module/ModuleManager";
import User from "./game/db/User";
import Resolution from "./engine/Resolution";
import LoginController from "./game/login/LoginController";
import SDKManager from "./sdk/SDKManager";
import { ChannelID } from "./sdk/SDKConfig";
import SceneManager from "./engine/SceneManager";

const { ccclass, property } = cc._decorator;

@ccclass
export default class Helloworld extends cc.Component {

    @property(cc.JsonAsset)
    gameData: cc.JsonAsset = null;

    @property(cc.Prefab)
    prefab: cc.Prefab = null;


    onLoad() {
        SDKManager.init(ChannelID.QQ)

        Resolution.init()
        ModuleManager.init('MyBabyUnin', SDKManager.getChannel().hasSubPackage())
        ModuleManager.dataManager.addFile(this.gameData)
        SceneManager.instance().init(this.node)
        SDKManager.getChannel().createNativeAd(0)
        SDKManager.getChannel().loadNativeAd()
        SDKManager.getChannel().loginZS();
    }

    start() {
        User.instance().init('MyBabyUnin')
        // this.node.addChild(cc.instantiate(this.prefab))
        // UIManager.instance().pushView()
        LoginController.instance().intoLayer(this.prefab)
        // new Timer().start()
    }
}
